package com.ywy.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ywy.dao.UsersMapper;
import com.ywy.entity.User;
import com.ywy.service.UsersService;
@Service
public class UsersServiceImpl implements UsersService {
	
	@Autowired
	private UsersMapper um;

	/**
	 * 根据id查询User
	 */
	@Override
	public User selectUserById(int user_id) {
		// TODO Auto-generated method stub
		return um.selectUserById(user_id);
	}

	/**
	 * 用户登录
	 */
	@Override
	public boolean userLogin(String user_name, String user_pwd) {
		// TODO Auto-generated method stub
		return um.userLogin(user_name, user_pwd);
	}
	
	/**
	 * 展示所有用户信息
	 */
	@Override
	public List<User> selectAllUsers() {
		// TODO Auto-generated method stub
		return um.selectAllUsers();
	}
	
	/**
	 * 注册用户信息
	 */
	@Override
	@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED)
	public boolean addUser(User user) {
		// TODO Auto-generated method stub
		return um.addUser(user);
	}
	
	/**
	 * 查询注册是否重名
	 */
	@Override
	public User selectUserByName(String user_name) {
		// TODO Auto-generated method stub
		return um.selectUserByName(user_name);
	}

}
